<template>
  <div style="position: relative;height: 100%">
    <div class="layout">
      <div class="admin-header" :style="curColor">
        <div class="logo" style=" font-size: 24px;
        color: white;
        display: inline-block;
        padding: 10px 20px;
        float: left;">
          <span>拼大侠</span>
        </div>
        <div class="nav">
          <!--<ul style="margin-top:0;border-radius:4px;padding-left:850px">-->
          <!--</ul>-->
        </div>

        <div class="nav">
          <ul>
            <li style="color: #fff;">
              <img style="width:12px;height:12px;margin-right:5px;" src="../../assets/peopen2.png"
                   alt=""/>
              用户名：{{userInfo.user}}
            </li>
            <router-link to="fundsmanagement">
              <span style="color:#ffb73d">本金：</span>
              <span style="color: #fff;">{{$store.state.money}}</span>
            </router-link>
            <li>
              <router-link to="accountrecharge">
                账户充值
              </router-link>
            </li>
            <li>
                            <span style="color:white;cursor: pointer;" @click="loginout()">
                                退出
                            </span>
            </li>
          </ul>
        </div>
      </div>
      <div class="indexContent">
        <div class="content-left">
          <el-menu class="el-menu-vertical-demo" :router=true :unique-opened=true
                   :default-active="$route.path">
            <!--                      店铺管理-->
            <h2 style="height:30px;cursor: pointer;margin-top:10px;">店铺管理</h2>
            <el-menu-item index="/mdd/task" title="绑定店铺" style="text-align: center">
              <span slot="title" style="">拼多多发布活动</span>
            </el-menu-item>
            <el-menu-item index="/mdd/dytask" title="绑定店铺" style="text-align: center">
              <span slot="title" style="">抖音发布活动</span>
            </el-menu-item>
              <el-menu-item index="/mdd/bindingshops" style="text-align: center">
                  <span slot="title">绑定店铺</span>
              </el-menu-item>
            <el-menu-item index="/mdd/Merchant" style="text-align: center">
              <span slot="title">邀请商家</span>
            </el-menu-item>
            <el-menu-item index="/mdd/price" style="text-align: center">
              <span slot="title">价格列表</span>
            </el-menu-item>
            <!--                    管理中心-->
            <h2 style="cursor: pointer">订单管理</h2>
            <el-menu-item index="/mdd/taskInfo" style="text-align: center">
              <span slot="title">订单明细</span>
            </el-menu-item>
            <el-menu-item index="/mdd/refundList" style="text-align: center">
              <span slot="title">订单审核</span>
            </el-menu-item>
            <h2 style="cursor: pointer">评价管理</h2>
            <el-menu-item index="/mdd/evaluation" style="text-align: center">
              <span slot="title">评价列表</span>
            </el-menu-item>
            <el-menu-item index="/mdd/evaluate" style="text-align: center">
              <span slot="title">评价审核</span>
            </el-menu-item>
            <h2 style="cursor: pointer;">管理中心</h2>
<!--            <el-menu-item index="/mdd/inform" style="text-align: center">-->
<!--                <span slot="title">我的通知</span>-->
<!--            </el-menu-item>-->
                <el-menu-item index="/mdd/fundsmanagement" style="text-align: center;margin-top:10px;">
                    <span slot="title">资产管理</span>
                </el-menu-item>
            <!--                        <el-menu-item @click="$router.push('passwordsetting')-->
            <!--                                " index="/mdd/passwordsetting" title="修改密码" value="/passwordsetting"-->
            <!--                                      style="text-align: center">-->
            <!--                            <span slot="title">修改密码</span>-->
            <!--                        </el-menu-item>-->
            <!--                      推广赚佣-->
            <!--                        <h2 style="cursor: pointer">推广赚佣</h2>-->
            <!--                        <el-menu-item index="ranking" style="text-align: center">-->
            <!--                            <span slot="title">排行榜</span>-->
            <!--                        </el-menu-item>-->
            <!--                        <el-menu-item index="/mdd/businesscenter" style="text-align: center">-->
            <!--                            <span slot="title">邀请商家</span>-->
            <!--                        </el-menu-item>-->
            <!--                      售后管理-->
            <!--                         <h2 style="cursor: pointer">售后管理</h2>-->
            <!--                         <el-menu-item index="/mdd/blacklist" style="text-align: center">-->
            <!--                             <span slot="title">黑名单</span>-->
            <!--                         </el-menu-item>-->
            <!--                         <el-menu-item index="/mdd/fankui" style="text-align: center">-->
            <!--                             <span slot="title">意见反馈</span>-->
            <!--                         </el-menu-item>-->
          </el-menu>
        </div>

        <div id="online_kefu" style=" z-index: 99999999;">
          <div id="floatTools" class="rides-cs" style="height:246px;">
            <div class="floatL" @click="qqShow = !qqShow">
              <a style="" id="aFloatTools_Show" class="btnOpen" title="查看售后客服"
                 v-if="!qqShow">展开</a>
              <a style="" id="aFloatTools_Hide" class="btnCtn" title="关闭售后客服" v-else>收缩</a>
            </div>
            <div id="divFloatToolsView" class="floatR" style="height:237px;width:140px;" v-show="qqShow">
              <div class="cn" style="margin-top:20px;">
                <h3 class="titZx" style="margin: 0;">微信客服</h3>
                <ul>
                  <li style="height:150px;border-bottom:0px;margin:4px;">
                                <span><img border="0" src="../../assets/wx.png" id="imgqrcode"
                                           style="width:110px;"></span>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>


        <div class="content-right">
          <div class="body" style="background:white;">
            <div
              style="height: 60px;display: flex;background:white;border-bottom: 1px solid #dfdfdf;margin-bottom: 25px;">
              <h3 style="font-size:24px;margin-left:10px;margin-top:6px;color:#333333;">
                {{bodyTitle}}
              </h3>
            </div>
            <router-view>
            </router-view>
          </div>
        </div>
      </div>
    </div>

    <el-dialog title="填写手机号" :visible.sync="dialogFormVisible" width="280px" :close-on-click-modal="close"
               :close-on-press-escape="close" :show-close="close">
      <el-form>
        <el-form-item label="手机号">
          <el-input v-model="phone" autocomplete="off" size="mini"></el-input>

        </el-form-item>
        <!--  <el-form-item label="验证码" prop="yzm">
              <el-input v-model="yzm" size="mini"></el-input>
              <el-button @click.prevent="getYzm" :disabled="yzm_btn">
                  {{buttonText}}
              </el-button>
          </el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {userinfo} from "../../api/api";

  export default {
    name: "AdminIndex",
    data() {
      return {
        yzm_btn: false,
        phone: "",
        yzm: "",
        buttonText: "获取验证码",
        close: false,
        dialogFormVisible: false,
        qqShow: false,
        orign: window.location.origin,
        hrefing: window.location.href,
        dialogMoney: false,
        default: "",
        activeList: "/user",
        bodyTitle: "",
        title: localStorage.getItem("currentTitle"),
        userInfo: {},
        curColor: {
          background: this.Currentcolor
        }
      };
    },
    methods: {
      userinfos() {
        userinfo().then(res => {
          this.userInfo = res.Data
          this.$store.commit('money', res.Data.Money)
        })
      },
      loginout() {
        this.$confirm('是否退出此次登录？', '确认信息', {
          confirmButtonText: '确认',
          cancelButtonText: '取消'
        }).then(() => {
          window.sessionStorage.removeItem('DK_token')
          this.$router.push('/')
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '取消退出'
          })
        });
      },
      // 路由切换
      routerChange(router) {
        let _this = this;
        switch (router.path) {
          case "/mdd/businesscenter":
            _this.bodyTitle = "商家管理";
            break;
          case "/mdd/fankui":
            _this.bodyTitle = "意见反馈";
            break;
          case "/mdd/Purchase_point":
            _this.bodyTitle = "购买萌点";
            break;
          case "/mdd/Merchant":
            _this.bodyTitle = "邀请商家";
            break;
          case "/mdd/ZFB":
            _this.bodyTitle = "支付宝";
            break;
          case '/mdd/recharge':
            _this.bodyTitle = "账号充值";
            break;
          case "/mdd/businesscenter2":
            _this.bodyTitle = "下属中间商管理";
            break;
          case "/mdd/price":
            _this.bodyTitle = "价格列表";
            break;
          case "/mdd/WeChat":
            _this.bodyTitle = "微信支付";
            break;
          case "/mdd/evaluation":
            _this.bodyTitle = "评价列表";
            break;
          case "/mdd/evaluate":
            _this.bodyTitle = "评价审核";
            break;
          case "/mdd/inform":
            _this.bodyTitle = "我的通知";
            break;
          case "/mdd/tj":
            _this.bodyTitle = "邀请有奖";
            break;
          case "/mdd/blacklist":
            _this.bodyTitle = "黑名单";
            break;
          case "/mdd/taskInfo":
            _this.bodyTitle = "订单明细";
            break;
          case "/mdd/log":
            _this.bodyTitle = "日志中心";
            break;
          case "/mdd/commentList":
            _this.bodyTitle = "评价审核";
            break;
          case "/mdd/refundList":
            _this.bodyTitle = "订单审核";
            break;
          case "/mdd/refundList1":
            _this.bodyTitle = "投诉中心";
            break;
          case "/mdd/setting":
            _this.bodyTitle = "配置中心";
            break;
          case "/mdd/money":
            _this.bodyTitle = "账务明细";
            break;
          case "/mdd/task":
            _this.bodyTitle = "拼多多发布活动";
            break;
          case "/mdd/dytask":
            _this.bodyTitle = "抖音发布活动";
            break;
          case "/mdd/index":
            _this.bodyTitle = "用户管理";
            break;
          case "/mdd/permissions":
            _this.bodyTitle = "权限设置";
            break;
          case "/mdd/ranking":
            _this.bodyTitle = "排行榜";
            break;
          case "/mdd/backup":
            _this.bodyTitle = "好评上传";
            break;
          case "/mdd/phone":
            _this.bodyTitle = "用户中心";
            break;
          case "/mdd/activity":
            _this.bodyTitle = "好评活动";
            break;
          case "/mdd/agentorder":
            _this.bodyTitle = "订单明细";
            break;
          case "/mdd/personagent":
            _this.bodyTitle = "个人代理中心";
            break;
          case "/mdd/information":
            _this.bodyTitle = "基本信息";
            break;
          case "/mdd/accountrecharge":
            _this.bodyTitle = "账户充值";
            break;
          case "/mdd/adcertification":
            _this.bodyTitle = "实名认证";
            break;
          case "/mdd/businesscenter":
            _this.bodyTitle = "商家中心";
            break;
          case "/mdd/passwordsetting":
            _this.bodyTitle = "修改登录密码";
            break;
          case "/mdd/fundsmanagement":
            _this.bodyTitle = "资产管理";
            break;
          case "/mdd/agentlist":
            _this.bodyTitle = "代理列表";
            break;
          case "/mdd/bindingshops":
            _this.bodyTitle = "绑定店铺";
            break;
          case "/mdd/bindingshop":
            _this.bodyTitle = "绑定新商家";
            break;
          case "/mdd/chat":
            _this.bodyTitle = "联系客服";
            break;
          case "/mdd/feedback":
            _this.bodyTitle = "意见反馈";
            break;
        }
      },
    },
    computed: {
      tbHeight() {
        return document.body.clientHeight - 145
      },
    },
    watch: {
      $route(a, b, c) {
        let _this = this;
        _this.routerChange(a);
      }
    },
    beforeCreate() {
      this.Currentcolor = localStorage.getItem("currentColor");
    },
    mounted() {
      this.default = window.location.host;
      console.log(window.location.host);
      let _this = this;
      let meta = document.getElementsByTagName("meta");
      meta[0].setAttribute("content", "");
      document.title = "拼大侠";
      //let result = /admin\/(\w+)/.exec(window.location.hash);
      let result = /mdd\/(\w+)/.exec(_this.$route.path);
      _this.routerChange(_this.$route);
      _this.$store.commit("switchAdmin", true);
      _this.$store.commit("switchId", "admin");
      _this.userinfos();
    }
  };
</script>
<style lang="scss">


  .rides-cs .btnOpen {
    background-position: -410px 0;

  }

  #online_kefu {
    position: fixed;
    width: 200px;
    height: auto;
    right: 0px;
    bottom: 100px;
  }

  .rides-cs {
    font-size: 12px;
    background: #29a7e2;
    position: fixed;
    top: 250px;
    right: 0px;
    _position: absolute;
    z-index: 1500;
    border-radius: 6px 0px 0 6px;
  }

  .rides-cs .floatL {
    width: 36px;
    float: left;
    position: relative;
    z-index: 1;
    margin-top: 21px;
    height: 181px;
  }

  .rides-cs .btnOpen, .rides-cs .btnCtn {
    position: relative;
    z-index: 9;
    top: 25px;
    left: 0;
    background-image: url(../../assets/shopnc.png);
    background-repeat: no-repeat;
    display: block;
    height: 146px;
    padding: 8px;
  }

  .rides-cs a {
    color: #00A0E9;
  }

  .rides-cs .floatL a {
    font-size: 0;
    text-indent: -999em;
    display: block;
  }

  .rides-cs .btnCtn {
    background-position: -450px 0;
  }

  .rides-cs .floatR {
    width: 130px;
    float: left;
    padding: 5px;
    overflow: hidden;
  }

  .rides-cs .floatR .cn {
    background: #F7F7F7;
    border-radius: 6px;
    margin-top: 4px;
  }

  .rides-cs .cn .titZx {
    font-size: 14px;
    color: #333;
    font-weight: 600;
    line-height: 24px;
    padding: 5px;
    text-align: center;
  }

  .rides-cs .cn ul {
    padding: 0px;
  }

  .rides-cs .cn ul li {
    line-height: 38px;
    border-bottom: solid 1px #E6E4E4;
    overflow: hidden;
    text-align: center;
  }

  .rides-cs .cn ul li span {
    color: #777;
  }

  .rides-cs .cn ul li img {
    vertical-align: middle;
  }

  .ceing {
    width: 100%;
    height: 300px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }

  .ce {
    position: relative;
    width: 75%;
    height: 50px;
    color: white;
    text-align: center;
    margin: 0 auto;

    .custom_service_bg {
      display: none;
      position: absolute;
      z-index: 9999;
      left: -132px;
      top: -27px;
      width: 130px;
      height: 100px;
      background: url('../../assets/custom_service_bg.png');
      background-size: 100% 100%;

      p {
        color: #000;
        padding-right: 10px;
        margin-bottom: 2px;
      }

      img {
        height: 30px;
        transform: translateX(-6px);
      }
    }

    &.online {
      &:hover > .custom_service_bg {
        display: block;
      }
    }
  }

  .ceing a {
    color: #fff;
  }

  .ce:hover a {
    color: #ff4081;
  }

  /*.el-menu-item{*/
  .ceing {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    border-radius: 5px;
  }

  .ce {
    position: relative;
    width: 70%;
    color: white;
    text-align: center;
    margin: 0 auto;

    a {
      display: block;
      padding: 15px 0;
    }

    .custom_service_bg {
      display: none;
      position: absolute;
      z-index: 9999;
      left: -132px;
      top: -12px;
      width: 130px;
      height: 100px;
      background: url('../../assets/custom_service_bg.png');
      background-size: 100% 100%;

      p {
        color: #000;
        padding-right: 10px;
        margin-bottom: 2px;
      }

      img {
        height: 30px;
        transform: translateX(-6px);
      }
    }

    &.online {
      &:hover > .custom_service_bg {
        display: block;
      }
    }
  }

  .ceing a {
    color: #fff;
  }

  .ce:hover a {
    color: #ff4081;
  }

  /*.el-menu-item{*/
  /*height:35px !important;*/
  /*line-height:35px !important;*/
  /*}*/
  .layout {
    background-color: rgb(236, 236, 236);
    min-height: 100%;
  }

  .admin-header {
    background-color: #409EFF;
    height: 60px;
  }

  .mu-item.selected .mu-item-left {
    color: #2196f3;
  }

  .el-menu-vertical-demo {
    border-radius: 5px;
  }

  .logo {

    /*font-size: 24px;*/
    color: white;
    display: inline-block;
    /*padding: 10px 20px;*/
    float: left;
  }

  .indexContent {
    display: flex;
    overflow: hidden;
    min-height: 100%;
  }

  .content-left {
    width: 200px;
    box-sizing: border-box;
    float: left;
    background-color: white;
    /*min-height: 873px;*/
    margin: 20px auto;
    /*border-radius:10px;*/
    overflow-y: auto;

    border-radius: 4px;
    /*margin-top: 20px;*/
    padding-top: 15px;
    /*overflow-y: auto;*/

  }

  .content-left::-webkit-scrollbar {
    display: none;
  }

  .content-left::-webkit-scrollbar {
    display: none;
  }

  .content-left ul {
    border: none;
  }

  .content-right {
    width: calc(100% - 240px);
    display: inline-block;
    float: right;
    margin-right: 40px;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0);
    min-height: 880px;

    .body {
      width: 100%;
      height: 100%;
      background: #fff;
      overflow-y: auto;
    }
  }

  .body {
    /*background-color: white;*/
    border-radius: 5px;
    padding: 15px;
    margin-top: 10px;
  }

  .listtitle {
    font-size: 14px;
    color: #3a8ee6;
  }

  .nav ul {
    /*text-align: center;*/
    padding: 0;
    margin: 0;
    width: calc(100% - 64px);
    text-align: right;
  }

  .nav ul li {
    list-style: none;
    display: inline-block;
    padding: 20px 25px;

    &:last-child {
      padding-right: 0;
    }
  }

  .nav ul li a {
    color: #fff;
  }

  .el-menu-item i,
  .el-menu-item span {
    vertical-align: middle;
  }

  .el-menu-item, .el-submenu__title {
    height: 42px;
    line-height: 42px;
  }

  .el-menu-vertical-demo h2 {
    font-size: 19px;
    color: #333;
    /*margin-left: 26px;*/
    height: 38px;
    line-height: 38px;
  }

  .el-menu-vertical-demo h2 {
    font-size: 19px;
    color: #333;
    padding-left: 60px;
    border-top: 1px dashed #ebebeb;
    padding-top: 15px;
    margin-bottom: 10px;

    &:first-child {
      padding-top: 0;
      border-top: none;
    }

    /*margin-left: 26px;*/
  }
</style>
